package com.evaluationsystem.system.controller;

import com.evaluationsystem.system.serivce.StaffService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@RequestMapping("staff")
@Api("员工录入CRUD接口 2020-4-14，gdy")
public class StaffController {

    @Autowired
    StaffService service;

    @GetMapping("")
    @ApiOperation("员工录入页面跳转接口")
    public String getStaffHtml(){
        return "system/staff/staff";
    }

    @PostMapping("staffSelectDatas")
    @ResponseBody
    @ApiOperation(value = "员工 table 筛选条件 加载 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> staffSelectDatas(){
        Map<String,Object> res = service.staffSelectDatas();
        return res;
    }

    @PostMapping("staffTableDatas")
    @ResponseBody
    @ApiOperation(value = "员工 table 数据加载 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> staffTableDatas(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.staffTableDatas(param);
        return res;
    }

    @GetMapping("staffAddHtml")
    @ApiOperation("员工新增页面跳转接口")
    public String staffAddHtml(){
        return "system/staff/staffAdd";
    }

    @PostMapping("staffAdd")
    @ResponseBody
    @ApiOperation(value = "员工 table 新增页面 保存 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> staffAdd(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.staffAdd(param);
        return res;
    }

    @PostMapping("staffStartAndForbid")
    @ResponseBody
    @ApiOperation(value = "员工 禁用/启用 修改 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> staffStartAndForbid(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.staffStartAndForbid(param);
        return res;
    }


    @GetMapping("staffUpdataHtml/{vstaffid}")
    @ApiOperation("员工修改页面跳转接口")
    public String staffUpdataHtml(@PathVariable("vstaffid") String vstaffid,Map<Object,Object> map){
        map.put("vstaffid",vstaffid);
        return "system/staff/staffUpdata";
    }


    @PostMapping("selStaffByStaffid")
    @ResponseBody
    @ApiOperation(value = "员工 修改页面 加载员工信息 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> selStaffByStaffid(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.selStaffByStaffid(param);
        return res;
    }

    @PostMapping("StaffByStaffid")
    @ResponseBody
    @ApiOperation(value = "员工 修改页面 保存 接口",notes = "2020-4-14，gdy")
    public Map<String,Object> StaffByStaffid(@RequestBody Map<String,Object> param){
        Map<String,Object> res = service.StaffByStaffid(param);
        return res;
    }



}
